#ifndef __PANEL_H__
#define __PANEL_H__
#include "gd32f10x.h"

/* Icon ID */
#define ICON_STATE_WIFI     0
#define ICON_STATE_LOCK     1
#define ICON_STATE_AC       2
#define ICON_STATE_DN       3
#define ICON_MODE_FRESH     4
#define ICON_MODE_ECO       5
#define ICON_MODE_DN        6
#define ICON_ACMODE_COOL    7
#define ICON_ACMODE_HEAT    8
#define ICON_ACMODE_AIR     9
#define ICON_ACMODE_DRY     10
#define ICON_SPEED_AUTO     11
#define ICON_SPEED_LOW      12
#define ICON_SPEED_MID      13
#define ICON_SPEED_HIGH     14
#define ICON_BTN_POWER      15
#define ICON_BTN_PAGE       16
#define ICON_BTN_OTHRE      17
#define ICON_NUM            18

/* 温度单位 */
#define UNIT_C              0   //摄氏度
#define UNIT_F              1   //华氏度

/* Tube类型 */
#define TUBE_TYPE_DEC       0
#define TUBE_TYPE_HEX       1
#define TUBE_TYPE_SWITCH    2

typedef struct 
{
    uint8_t  codeId[2];
    uint8_t  val;
    uint8_t  type;
    uint8_t  flag;
    uint16_t blink;
    uint8_t  blinkTimeout;
    uint8_t  unitFlag;
    uint16_t unitBlink;
}Tube;

typedef struct 
{
    uint8_t id;
    uint8_t state;
    uint8_t codeIndex;
    uint8_t codeBit;
    uint8_t blink;
    uint8_t blinkTimeout;
}Icon;

typedef struct 
{
    uint8_t  code[9];
	Tube     tube[3];
    uint8_t  unit;
    Icon     icon[ICON_NUM];
	uint8_t  luminance;
}Panel;

void panel_icon_blink_set(uint8_t id, uint8_t blinkCnt);
void panel_tubex_blink_set(uint8_t tubeId, uint16_t blinkCnt);
void panel_unitx_blink_set(uint8_t id, uint16_t blinkCnt);
void panel_luminance_set(uint8_t level);
void panel_unit_set(uint8_t type);
void panel_process(void);
void panel_init(void);
#endif
